﻿//------------------------------------------------------------------------------
// The contents of this file are subject to the nopCommerce Public License Version 1.0 ("License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at  http://www.nopCommerce.com/License.aspx. 
// 
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
// See the License for the specific language governing rights and limitations under the License.
// 
// The Original Code is nopCommerce.
// The Initial Developer of the Original Code is NopSolutions.
// All Rights Reserved.
// 
// Contributor(s): _______. 
//------------------------------------------------------------------------------

using System;
using System.Web.UI;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.ExportImport;
using NopSolutions.NopCommerce.BusinessLogic.Infrastructure;
using NopSolutions.NopCommerce.BusinessLogic.Services;
using NopSolutions.NopCommerce.BusinessLogic.Providers;

namespace NopSolutions.NopCommerce.Web
{
    public partial class BaseNopPage : Page
    {
        private ISettingService _settingService;

        public BaseNopPage() {
            _settingService = IoC.Resolve<ISettingService>();
        }

        protected void Page_Load(object sender, EventArgs e) {
            //online user tracking
            if (this.TrackedByOnlineCustomersModule) {
                this.OnlineUserService.TrackCurrentUser();
            }                        
        }

        protected string GetLocaleResourceString(string resourceName) {
            var language = NopContext.Current.WorkingLanguage;
            return this.LocalizationManager.GetLocaleResourceString(resourceName, language.LanguageId);
        }

        /// <summary>
        /// Gets a value indicating whether this page is tracked by 'Online Customers' module
        /// </summary>
        public virtual bool TrackedByOnlineCustomersModule {
            get {
                return true;
            }
        }

        #region Services, managers

        public IOnlineUserService OnlineUserService {
            get { return IoC.Resolve<IOnlineUserService>(); }
        }
        public ICustomerActivityService CustomerActivityService {
            get { return IoC.Resolve<ICustomerActivityService>(); }
        }
        public ILogService LogService {
            get { return IoC.Resolve<ILogService>(); }
        }
        public ISearchLogService SearchLogService {
            get { return IoC.Resolve<ISearchLogService>(); }
        }
        public ICategoryService CategoryService {
            get { return IoC.Resolve<ICategoryService>(); }
        }
        public ISettingService SettingManager {
            //get { return IoC.Resolve<ISettingService>(); }
            get { return _settingService; }
        }
        public IBlogService BlogService {
            get { return IoC.Resolve<IBlogService>(); }
        }
        public IForumService ForumService {
            get { return IoC.Resolve<IForumService>(); }
        }
        public INewsService NewsService {
            get { return IoC.Resolve<INewsService>(); }
        }
        public IPollService PollService {
            get { return IoC.Resolve<IPollService>(); }
        }
        public ITopicService TopicService {
            get { return IoC.Resolve<ITopicService>(); }
        }
        public ICustomerService CustomerService {
            get { return IoC.Resolve<ICustomerService>(); }
        }
        public ICountryService CountryService {
            get { return IoC.Resolve<ICountryService>(); }
        }
        public ICurrencyService CurrencyService {
            get { return IoC.Resolve<ICurrencyService>(); }
        }
        public ILanguageService LanguageService {
            get { return IoC.Resolve<ILanguageService>(); }
        }
        public IStateProvinceService StateProvinceService {
            get { return IoC.Resolve<IStateProvinceService>(); }
        }
        public IExportManager ExportManager {
            get { return IoC.Resolve<IExportManager>(); }
        }
        public IImportManager ImportManager {
            get { return IoC.Resolve<IImportManager>(); }
        }
        public ILocalizationService LocalizationManager {
            get { return IoC.Resolve<ILocalizationService>(); }
        }
        public IMaintenanceService MaintenanceService {
            get { return IoC.Resolve<IMaintenanceService>(); }
        }
        public IManufacturerService ManufacturerService {
            get { return IoC.Resolve<IManufacturerService>(); }
        }
        public IMeasureService MeasureService {
            get { return IoC.Resolve<IMeasureService>(); }
        }
        public IDownloadService DownloadService {
            get { return IoC.Resolve<IDownloadService>(); }
        }
        public IPictureService PictureService {
            get { return IoC.Resolve<IPictureService>(); }
        }
        public ISMSService SMSService {
            get { return IoC.Resolve<ISMSService>(); }
        }
        public IMessageService MessageService {
            get { return IoC.Resolve<IMessageService>(); }
        }
        public IOrderService OrderService {
            get { return IoC.Resolve<IOrderService>(); }
        }
        public IShoppingCartService ShoppingCartService {
            get { return IoC.Resolve<IShoppingCartService>(); }
        }
        public IPaymentService PaymentService {
            get { return IoC.Resolve<IPaymentService>(); }
        }
        public ICheckoutAttributeService CheckoutAttributeService {
            get { return IoC.Resolve<ICheckoutAttributeService>(); }
        }
        public IProductAttributeService ProductAttributeService {
            get { return IoC.Resolve<IProductAttributeService>(); }
        }
        public ISpecificationAttributeService SpecificationAttributeService {
            get { return IoC.Resolve<ISpecificationAttributeService>(); }
        }
        public IProductService ProductService {
            get { return IoC.Resolve<IProductService>(); }
        }
        public IAffiliateService AffiliateService {
            get { return IoC.Resolve<IAffiliateService>(); }
        }
        public ICampaignService CampaignService {
            get { return IoC.Resolve<ICampaignService>(); }
        }
        public IDiscountService DiscountService {
            get { return IoC.Resolve<IDiscountService>(); }
        }
        public IQBService QBService {
            get { return IoC.Resolve<IQBService>(); }
        }
        public IACLService ACLService {
            get { return IoC.Resolve<IACLService>(); }
        }
        public IBlacklistService BlacklistService {
            get { return IoC.Resolve<IBlacklistService>(); }
        }
        public IShippingByTotalService ShippingByTotalService {
            get { return IoC.Resolve<IShippingByTotalService>(); }
        }
        public IShippingByWeightAndCountryService ShippingByWeightAndCountryService {
            get { return IoC.Resolve<IShippingByWeightAndCountryService>(); }
        }
        public IShippingByWeightService ShippingByWeightService {
            get { return IoC.Resolve<IShippingByWeightService>(); }
        }
        public IShippingRateComputationMethod ShippingRateComputationMethod {
            get { return IoC.Resolve<IShippingRateComputationMethod>(); }
        }
        public IShippingService ShippingService {
            get { return IoC.Resolve<IShippingService>(); }
        }
        public ITaxCategoryService TaxCategoryService {
            get { return IoC.Resolve<ITaxCategoryService>(); }
        }
        public ITaxProviderService TaxProviderService {
            get { return IoC.Resolve<ITaxProviderService>(); }
        }
        public ITaxRateService TaxRateService {
            get { return IoC.Resolve<ITaxRateService>(); }
        }
        public ITaxService TaxService {
            get { return IoC.Resolve<ITaxService>(); }
        }
        public ITemplateService TemplateService {
            get { return IoC.Resolve<ITemplateService>(); }
        }
        public IWarehouseService WarehouseService {
            get { return IoC.Resolve<IWarehouseService>(); }
        }
        #endregion
    }
}